<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>确认缴费</title>
    <!-- 引入 WeUI -->
    <link rel="stylesheet" href="http://jxt.anan365.com/jiaofei/Public/weui-1.1.2/dist/style/weui.css"/>
    <script src="http://jxt.anan365.com/jiaofei/Public/jquery.js"></script>
</head>
<script type="text/javascript">
    history.pushState(null,null,"/");
    //调用微信JS api 支付
    function jsApiCall()
    {
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest',
            <?php echo $jsApiParameters; ?>,
            function(res){
                //WeixinJSBridge.log(res.err_msg);
                if(res.err_msg == 'get_brand_wcpay_request:cacel'){
                    upd_order_type();
                }else if(res.err_msg == 'get_brand_wcpay_request:fail'){
                    alert('支付失败!('+res.err_desc+')'+JSON.stringify(res));
                }else if(res.err_msg == 'get_brand_wcpay_request:ok'){
                    var openid = $('#openid').val();
                    location.href = 'http://jxt.anan365.com/jiaofei/index.php/Home/Index/mypay/openid/'+openid;
                }else{
                    alert(JSON.stringify(res));
                }
            }
        );
    }

    function upd_order_type(){
        var orderid = "<?php echo $order['order_id'];?>";
        alert(orderid);
    }

    function callpay()
    {
        if (typeof WeixinJSBridge == "undefined"){
            if( document.addEventListener ){
                document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
            }else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
            }
        }else{
            jsApiCall();
        }
    }
</script>
<body ontouchstart>
<div class="page__hd">
    <h1 class="page__title" style="text-align: center;font-size: 18px;margin-top:20px">确认缴费</h1>
</div>
<div class="page__bd">
    <input type="hidden" id="openid" value="<?php echo $order['open_id'];?>">
    <div class="weui-form-preview">
        <div class="weui-form-preview__hd">
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">付款金额</label>
                <em class="weui-form-preview__value"><?php echo $order['money']/100;?>元</em>
            </div>
        </div>
        <div class="weui-form-preview__bd">
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">商品</label>
                <span class="weui-form-preview__value">安全园务接送平台--缴费</span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">订单号</label>
                <span class="weui-form-preview__value"><?php echo $order['order_id'];?></span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">学生姓名</label>
                <span class="weui-form-preview__value"><?php echo $order['student'];?></span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">学校</label>
                <span class="weui-form-preview__value"><?php echo $school;?></span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">班级</label>
                <span class="weui-form-preview__value"><?php echo $class;?></span>
            </div>
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">联系电话</label>
                <span class="weui-form-preview__value"><?php echo $order['phone'];?></span>
            </div>
        </div>
        <div class="weui-btn-area">
            <a class="weui-btn weui-btn_primary" href="javascript:" onclick="callpay()" id="showTooltips">立即支付</a>
        </div>
    </div>
</div>

</body>
</html>
